package com.mrdeer.common.entity.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.mrdeer.common.base.Converter;
import com.mrdeer.common.entity.beans.PageEntity;
import com.mrdeer.common.entity.sys.DictData;
import lombok.*;
import org.springframework.beans.BeanUtils;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class DictDataDTO extends DictData implements Converter<DictDataDTO, DictData> {

    private static final long serialVersionUID = 7420499695829464276L;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private PageEntity page;

    @Override
    public void convert2Do(DictDataDTO dto) {
        BeanUtils.copyProperties(this, dto);
    }

    @Override
    public DictData convert(DictDataDTO dto) {
        BeanUtils.copyProperties(dto, this);
        return this;
    }
}
